var server="http://121.41.88.185:8080";
var cab="&callback=?";

//login sever config
var loginServer={
  fun:"/parkUser.action?login",
  telephone:"&telephone=",
  password:"&password=",
  getLoginReq:function(tel,pas){
    return server+this.fun+this.telephone+tel+this.password+pas+cab;
  }
}

//logout sever config
var logoutServer={
  fun:"/parkUser.action?logout&callback=?",
  telephone:"&telephone=",
  getLogoutReq:function(tel){
    return server+this.fun+this.telephone+tel+cab;
  }
}

//get validation code server config
var validationServer={
  fun:"/parkUser.action?getRegCode",
  telephone:"&telephone=",
  getValReq:function(tel){
    return server+this.fun+this.telephone+tel+cab;
  }
}

// register user server config
var registerServer={
  fun:"/parkUser.action?register",
  telephone:"&telephone=",
  password:"&password=",
  typet:"&type=1",
  regcode:"&regCode=",
  getRegisterReq:function(tel,pas,regcode){
    return server+this.fun+this.telephone+tel+this.password+pas+this.typet+this.regcode+regcode+cab;
  }
}

// update user infor server config
var updateInfServer={
  fun:"/parkUser.action?updateUser",
  telephone:"&telephone=",
  sex:"&sex=",
  namen:"&name=",
  carNo:"&carNo=",
  engineNo:"&engineNo=",
  getUpdateInfReq:function(tel,sex,na,cno,eno){
    return server+this.fun+this.telephone+tel+this.sex+sex+this.namen+na+this.carNo+cno+this.engineNo+eno+cab;
  }
}

//loading parking time and cost infor server config
var parkUserServer={
  fun:"/parkUser.action?loadBillDetail",
  parkNo:"&parkNo=",
  getParkUserSerReq:function(pn){
    return server+this.fun+this.parkNo+pn+cab;
  }
}

//
var createrOrderServer={
  fun:"/parkUser.action?createPreOrder",
  totalFee:"&totalFee=",
  parkNo:"&parkNo=",
  telephone:"&telephone=",
  getCreaterOrderReq:function(tf,pn,tp){
    return server+this.fun+this.totalFee+tf+this.parkNo+pn+this.telephone+tp+cab;
  }
}

function hideMainAFooter(){
  $("#mainfooter").hide();
  $("#mainheader").hide();
}

function showMainAFooter(){
  $("#mainfooter").show();
  $("#mainheader").show();
}

//pop base function
function popSucc(message){
  $.afui.popup({
    title: "",
    message: "<div style='text-align:center;'><img src='./img/messagesucc.png' />"
    +"<div style='padding:5px;'>"
    +message+"</div></div>",
    cancelOnly:true,
    cancelText:"确定",
    cancelClass:"button center alertButton"            
  });
}

//faild message popup
function popFaild(message){
  $.afui.popup({
    title: "",
    message: "<div style='text-align:center;'><img src='./img/messagefaild.png' />"
    +"<div style='padding:5px;'>"
    +message+"</div></div>",
    cancelOnly:true,
    cancelText:"确定",
    cancelClass:"button center alertButton"            
  });
}

//choice message popup
function popChoice(message,doneCal,calCal){
  $.afui.popup({
    title: "",
    message: "<div style='text-align:center;'><img src='./img/messagefaild.png' />"
    +"<div style='padding:5px;'>"
    +message+"</div></div>",
    cancelOnly:false,
    doneText:"登录&注册",
    doneClass:"button choiceButton",
    cancelText:"取消",
    cancelClass:"button choiceButton",
    cancelCallback: function(){calCal},
    doneCallback: function(){doneCal()},    
  });
}

function resetAll(){
  $("input").each(function(){
    $(this).val("");
  });
  $("#hours").html("00");
  $("#mints").html("00");
  $("#cost").html(" ￥0.00");
}

function isNumber(event, element) {
  if (event) {
    var max_chars = element.getAttribute("max").length;
    var charCode = (event.which) ? event.which : event.keyCode;
    if (charCode != 190 && charCode > 31 &&
      (charCode < 48 || charCode > 57) &&
      (charCode < 96 || charCode > 105) &&
      (charCode < 37 || charCode > 40) &&
      charCode != 110 && charCode != 8 && charCode != 46 ) {
        return false;
    }
    if (element.value.length >= max_chars && charCode > 47) {
      return false;
    }else {
      return true;
    }
  }
}


function Carman(phoneno,namen,sex,carno,engno)
{
   this.phoneno=phoneno;
   this.name=namen;
   this.sex=sex;
   this.carno=carno;
   this.engno=engno;
}
Carman.prototype.getPhone=function(){
   return this.phoneno;
}

var Jsontest={
  attri1:15,
  attri2:"This is a string",
  attri3:function(){
    alert('this is a function');
  }
};
